Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Graphics /
Chapter 4 - Geometric Operations / Geometric Operations Reference
Functions / Getting and Setting Shape Bounds


GXGetShapeBounds

You can use the GXGetShapeBounds function to determine the bounding rectangle of a shape or of a specified contour of a shape.

gxRectangle *GXGetShapeBounds(gxShape source, long index, 
                              gxRectangle *bounds);
source
A reference to the shape containing the contour whose bounding rectangle you want to find.
index
The number of the contour whose bounding rectangle you want to find. You may specify a value of 0 to indicate you want to find the bounding rectangle of the entire shape.
bounds
A pointer to a gxRectangle structure. On return, this structure contains the bounding rectangle of the specified contour.
function result
The bounding rectangle of the specified contour. (This value is the
same as the value returned in the bounds parameter.)
DESCRIPTION
The GXGetShapeBounds function determines the bounding rectangle of the contour specified by the index parameter of the shape specified by the source parameter. If you specify a value of 0 for the index parameter, this function finds the bounding rectangle of the entire source shape.

The bounding rectangle of a shape (or of a contour of a shape) is the smallest rectangle that contains the geometry of the shape (or of the contour).

This function finds the bounding rectangle of the source shape (or a contour of the source shape) as defined by the source shape's geometry; it does not consider shape fill or transformations to the shape made by the shape's transform.

For empty shapes and full shapes, this function posts the warning shape_passed_has_no_bounds. For full shapes, it returns an infinitely large rectangle; for empty shapes, it returns the inverse rectangle.

If you provide a target shape that is not one of the geometric shape types, this function performs the actions described in the following table:
Shape typeAction taken
bitmapReturns the bounding rectangle
pictureReturns the bounding rectangle for the entire picture
textReturns bounding rectangle of specified glyphs
glyphReturns bounding rectangle of specified glyphs
layoutPosts the error functionality_unimplemented if the index parameter is not zero; returns bounding rectangle of glyphs otherwise

ERRORS, WARNINGS, AND NOTICES
Errors 
out_of_memory 
shape_is_nil 
contour_is_less_than_zero 
parameter_is_nil(debugging version)
functionality_unimplemented(debugging version)
Warnings 
contour_out_of_range 
shape_passed_has_no_bounds(debugging version)
unable_to_traverse_open_contour_that_starts_or_ends_off_the_curve
 (debugging version)
SEE ALSO
For a discussion of rectangles and bounding rectangles, see Chapter 2, "Geometric Shapes," in this book.

To find the center of a shape or a contour of a shape, use the GXGetShapeCenter function, which is described on page 4-87.

To change the bounding rectangle of a shape, use the GXSetShapeBounds function, described in the next section.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help